import React, {useEffect} from 'react';
import {Card, Table} from "antd";
import clientInfoColumns from "columns/ClientInfoColumns";
import LogFactory from "log/LogFactory";
import {ClientInfo} from "type/ClientInfo";
import {requestClientList} from "../RequestHandler";

const log = LogFactory.getLog("ClientComponent");
const ClientComponent = () => {
    const [data, setData] = React.useState<ClientInfo[]>([]);
    useEffect(() => {
        requestClientList().then((res) => {
            if (res.success){
                setData(res.data);
            }
        }) ;
    }, []);


    return (
        <Card title={"客户信息"} >
            <Table<ClientInfo>
                columns={clientInfoColumns}
                dataSource={data}
                rowKey={"key"}
                />
        </Card>
    );
};

export default ClientComponent;